<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="@dimen/default_margins"
    tools:context=".ui.screens.search.SearchFragment">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/searchLayout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="@drawable/search_layout_background"
        android:paddingHorizontal="24dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ImageView
            android:id="@+id/searchImageView"
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:src="@drawable/ic_search"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@id/searchEditText"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <androidx.appcompat.widget.AppCompatEditText
            android:id="@+id/searchEditText"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginHorizontal="@dimen/_6sdp"
            android:background="@null"
            android:hint="@string/search_hint"
            android:maxLines="1"
            android:orientation="horizontal"
            android:imeOptions="actionSearch"
            android:textSize="24sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="@id/searchOptionButton"
            app:layout_constraintStart_toEndOf="@id/searchImageView"
            app:layout_constraintTop_toTopOf="parent" />

        <ImageButton
            android:id="@+id/searchOptionButton"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:background="@null"
            android:contentDescription="@string/search_options"
            android:src="@drawable/ic_search_parameters"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@id/searchEditText"
            app:layout_constraintTop_toTopOf="parent" />
    </androidx.constraintlayout.widget.ConstraintLayout>

    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
        android:id="@+id/swipeToRefresh"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/searchLayout">

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/searchResultRecyclerView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="@dimen/default_margins"
            android:contentDescription="@string/films"
            android:orientation="vertical"
            app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

    <TextView
        android:id="@+id/emptyResultTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/default_margins"
        android:text="@string/search_nothing_was_found"
        android:textAlignment="center"
        android:visibility="gone"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/searchLayout" />
</androidx.constraintlayout.widget.ConstraintLayout>